// 强化和魔石计算
export function strongZB(row, data, zbName) {
    // console.log(row,data,zbName)
    // 武器强化
    // 每件武器强化增加值不一样
    // 每件防具强化增加值也不一样
    
    let strongModel = {}
    let msModel = {}
    if (row.ZBType == 1) {
        // 武器强化 攻击力和增幅力
        strongModel.wlgj = data.strong ? Number(WQStrongInfo(row.type)) * Number(data.strong ? data.strong : 0) : 0
        strongModel.mfzfl = data.strong ? Number(data.strong ? data.strong : 0) * 20 : 0
    }
    if (row.ZBType == 2) {
        // 防具强化 hp
        strongModel.hp = data.strong ? Number(FJStrongInfo(row.type,zbName).hp) * Number(data.strong ? data.strong : 0) : 0
    }
    
    // 魔石计算
    msModel = calcMoShi(data)

    return {
        strongModel,
        msModel
    }
}

// 魔石 合计
export function calcMoShi(data) {
    // console.log(data)
    let msModel = {}
    if (data.msList && data.msList.length > 0) {
        data.msList.forEach(item => {
            if (item.type == 'ewlgj') {
                msModel.ewlgj = Number(item.number) * item.value
            }
            if (item.type == 'ewlzm') {
                msModel.ewlzm = Number(item.number) * item.value
            }
            if (item.type == 'ehp') {
                msModel.ehp = Number(item.number) * item.value
            }
            if (item.type == 'emfzf') {
                msModel.emfzf = Number(item.number) * item.value
            }
        })
    }
    return msModel
}
// 按武器类型返回默认强化 增加的攻击力
export function WQStrongInfo(type) {
    if (type == '战戟' || type == '法杖') {
        return 3
    } else if (type == '短剑' || type == '单手剑') {
        return 2
    } else if (type == '弓') {
        return 4
    } else {
        return 0
    }
}
// 防具 强化
export function FJStrongInfo(type, zbName) {

    if (type == '布甲') {
        if (zbName == 'fjYiFu') {
            let hp = 14
            return {
                hp
            }
        } else if (zbName == 'fjXiaYi') {
            let hp = 12
            return {
                hp
            }
        }else{
            let hp = 10
            return {
                hp
            }
        }
    }

    if (type == '皮甲') {
        if (zbName == 'fjYiFu') {
            let hp = 12
            return {
                hp
            }
        } else if (zbName == 'fjXiaYi') {
            let hp = 10
            return {
                hp
            }
        }else{
            let hp = 8
            return {
                hp
            }
        }
    }

    if (type == '琐甲') {
        if (zbName == 'fjYiFu') {
            let hp = 10
            return {
                hp
            }
        } else if (zbName == 'fjXiaYi') {
            let hp = 8
            return {
                hp
            }
        }else{
            let hp = 6
            return {
                hp
            }
        }
    }

    if (type == '板甲') {
        if (zbName == 'fjYiFu') {
            let hp = 8
            return {
                hp
            }
        } else if (zbName == 'fjXiaYi') {
            let hp = 6
            return {
                hp
            }
        }else{
            let hp = 4
            return {
                hp
            }
        }
    }
}